use rusty_engine::prelude::*;
use crate::game_state::GameScene;

mod game_state;
mod scenes;

// sprite图显示层级
const BACKGROUND_LAYER: f32 = 0.0;
const CHARACTER_LAYER: f32 = 1.0;
const UI_BOTTOM_LAYER: f32 = 3.0;
const UI_TOP_LAYER: f32 = 4.0;

fn main() {
    let mut game = Game::new();

    // 设置窗口标题
    game.window_settings(Window {
        title: "究极赛车".into(),
        resolution : (1280.0, 720.0).into(),
        ..Default::default()
    });

    // 初始化游戏状态
    let mut game_state = game_state::GameState::default();
    game_state.last_scene = GameScene::GameOver;
    game_state.current_scene = GameScene::MainMenu;
    
    game_state.health_amount.push(5);
    game_state.health_amount.push(5);

    game_state.coins.push(0);
    game_state.coins.push(0);

    game_state.distance.push(0.0);
    game_state.distance.push(0.0);

    game_state.hit.push(false);
    game_state.hit.push(false);

    game_state.lost.push(false);
    game_state.lost.push(false);

    game_state.hit_timer.push(Timer::from_seconds(0.0, TimerMode::Once));
    game_state.hit_timer.push(Timer::from_seconds(0.0, TimerMode::Once));

    game_state.score.push(0);
    game_state.score.push(0);

    // 添加主逻辑
    game.add_logic(scenes::scene_logic);
    game.run(game_state);
}